/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package internationalization.i18n;

import java.util.Locale;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

/**
 *
 * @author dpaul
 */
@ManagedBean(name = "i18n")
@SessionScoped
public class LocalI18n {

    private String language = "es";

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public void locale(ValueChangeEvent e) {
        Locale locale = new Locale(String.valueOf(e.getNewValue()));
        FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
    }
}
